package com.parktech.sun.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 11-1-17
 * Time: 下午10:38
 * To change this template use File | Settings | File Templates.
 */
public class AjaxUtil {

    	public static synchronized void outPutJsonStr(HttpServletResponse response,String jsonStr) throws IOException {
		response.setCharacterEncoding("utf-8");
		response.setHeader("Pragma", "no-cache");
		response.setHeader("Cache-Control", "no-cache,no-store,must-revalidate,max-age=-1");
		response.setDateHeader("Expires", 0);
		response.setContentType("text/plain");
		PrintWriter out = response.getWriter();
		try {
			Thread.sleep(500);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
		}
		out.println(jsonStr);
		out.close();
	}
}
